package beans

import (
	"github.com/gin-gonic/gin"
	"net/http"
)

// JumpPage 跳转页面
type JumpPage struct{}

// JumpPage 重定向到指定页面
func (j JumpPage) JumpPage(c *gin.Context, redirectUrl string) {
	c.Redirect(http.StatusFound, redirectUrl)
}

// JumpPageForward 跳转到页面
func (j JumpPage) JumpPageForward(c *gin.Context, isWeChatBrowser bool, params string) {
	c.HTML(http.StatusOK, "index/index.html", gin.H{
		"isWeChatBrowser": isWeChatBrowser,
		"params":          params,
	})
}

// JumpPageSecure 跳转到安全红页面
func (j JumpPage) JumpPageSecure(c *gin.Context, isWeChatBrowser bool, params string) {
	c.HTML(http.StatusOK, "zgh/index.html", gin.H{
		"isWeChatBrowser": isWeChatBrowser,
		"params":          params,
	})
}

// JumpPageWeChat 微信内提示
func (j JumpPage) JumpPageWeChat(c *gin.Context, email string, icp string) {
	c.HTML(http.StatusOK, "wechat/index.html", gin.H{
		"email": email,
		"icp":   icp,
	})
}

func (j JumpPage) JumpPageCpsForward(c *gin.Context, isWeChatBrowser bool, params string) {
	c.HTML(http.StatusOK, "cps/index.html", gin.H{
		"isWeChatBrowser": isWeChatBrowser,
		"params":          params,
	})
}
